package com.gxa.service.impl;

import com.gxa.common.R;
import com.gxa.common.vo.FinancialReportVo;
import com.gxa.mapper.FinancialReportMapper;
import com.gxa.service.FinancialReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FinancialReportServiceImpl implements FinancialReportService {
    @Autowired
    FinancialReportMapper financialReportMapper;


    /**
     * 财务报表
     * @return
     */
    @Override
    public R financialStatement() {
        R r = new R();
        List<FinancialReportVo> list = financialReportMapper.financialStatement();
        if (list != null && list.size() > 0){
            r.setCode(200);
            r.setMsg("success");
            r.setData(list);
        }else {
            r.setCode(500);
            r.setMsg("服务器开小差");
        }
        return r;
    }
    /**
     * 本年度盈利报告
     * @return
     */
    @Override
    public R yearlyEarnings() {
        R r = new R();
        List<FinancialReportVo> list = financialReportMapper.yearlyEarnings();
        if (list != null && list.size() > 0){
            r.setCode(200);
            r.setMsg("success");
            r.setData(list);
        }else {
            r.setCode(500);
            r.setMsg("服务器开小差");
        }
        return r;
    }

    /**
     * 详细收支报告
     * @return
     */
    @Override
    public R financialDetail() {
        R r = new R();
        List<FinancialReportVo> list = financialReportMapper.financialDetail();
        if (list != null && list.size() > 0){
            r.setCode(200);
            r.setMsg("success");
            r.setData(list);
        }else {
            r.setCode(500);
            r.setMsg("服务器开小差");
        }
        return r;
    }
}
